class Vec2 {
    source = [];
    constructor(source: number[] = [0]) {
        this.source = source;
    }

    get x() {
        return this.source[0];
    }
    set x(v) {
        this.source[0] = v;
    }
}

class Vec2_1 {
    x = 0;
}

var vec = new Vec2();
var vec1 = new Vec2_1();

const num = 100000000;

console.time('1');
for (let i = 0; i < num; i++) {
    vec.x = num;
    vec.x = vec.x + 1;
}
console.timeEnd('1');

console.time('2');
for (let i = 0; i < num; i++) {
    vec1.x = num;
    vec1.x = vec1.x + 1;
}
console.timeEnd('2');

console.time('1');
for (let i = 0; i < num; i++) {
    vec.x = num;
    vec.x = vec.x + 1;
}
console.timeEnd('1');

console.time('2');
for (let i = 0; i < num; i++) {
    vec1.x = num;
    vec1.x = vec1.x + 1;
}
console.timeEnd('2');